themingengine: Use GtkRoundedBox for drawing backgrounds
authorBenjamin Otte <otte@redhat.com>
Sat, 11 Jun 2011 02:14:19 +0000 (04:14 +0200)
committerBenjamin Otte <otte@redhat.com>
Sat, 11 Jun 2011 07:29:42 +0000 (09:29 +0200)
gtk/gtkthemingengine.c

index 863ea8c0505cde85221bf8f66da8fb29df733313..b35119d39c8876e2cc4595c92bacccda7354de54 100644 (file)
@@ -32,6 +32,7 @@
 #include "gtkshadowprivate.h"
 #include "gtkcsstypesprivate.h"
 #include "gtkthemingengineprivate.h"
+#include "gtkroundedboxprivate.h"
 
 /**
  * SECTION:gtkthemingengine
@@ -1511,9 +1512,7 @@ render_background_internal (GtkThemingEngine *engine,
   GtkStateFlags flags;
   gboolean running;
   gdouble progress;
-  GtkCssBorderCornerRadius *top_left_radius, *top_right_radius;
-  GtkCssBorderCornerRadius *bottom_left_radius, *bottom_right_radius;
-  GtkCssBorderRadius border_radius = { { 0, },  };
+  GtkRoundedBox border_box;
 
   flags = gtk_theming_engine_get_state (engine);
 
@@ -1521,27 +1520,8 @@ render_background_internal (GtkThemingEngine *engine,
 
   gtk_theming_engine_get (engine, flags,
                           "background-image", &pattern,
-                          /* Can't use border-radius as it's an int for
-                           * backwards compat */
-                          "border-top-left-radius", &top_left_radius,
-                          "border-top-right-radius", &top_right_radius,
-                          "border-bottom-right-radius", &bottom_right_radius,
-                          "border-bottom-left-radius", &bottom_left_radius,
                           NULL);
 
-  if (top_left_radius)
-    border_radius.top_left = *top_left_radius;
-  g_free (top_left_radius);
-  if (top_right_radius)
-    border_radius.top_right = *top_right_radius;
-  g_free (top_right_radius);
-  if (bottom_right_radius)
-    border_radius.bottom_right = *bottom_right_radius;
-  g_free (bottom_right_radius);
-  if (bottom_left_radius)
-    border_radius.bottom_left = *bottom_left_radius;
-  g_free (bottom_left_radius);
-
   cairo_save (cr);
   cairo_translate (cr, x, y);
 
@@ -1728,9 +1708,10 @@ render_background_internal (GtkThemingEngine *engine,
         cairo_pattern_destroy (other_pattern);
     }
 
-  _cairo_round_rectangle_sides (cr, &border_radius,
-                                0, 0, width, height,
-                                SIDE_ALL);
+  _gtk_rounded_box_init_rect (&border_box, 0, 0, width, height);
+  _gtk_rounded_box_apply_border_radius (&border_box, engine, flags, junction);
+  _gtk_rounded_box_path (&border_box, cr);
+
   if (pattern)
     {
       cairo_scale (cr, width, height);